package model.ds;


import model.HexDirection;
import model.ds.piece.Piece;


/**
 * <p>A game tile represents a hexagonal area of the (theoretically infinite)
 * game board.</p>
 * <p>It is used to set up a graph for the game. In that sense, a tile
 * represents a node. The six neighbor tiles are known and the connection to
 * them can be assumed as edges in the graph. They are indexed by 0-5 which
 * equals the ordinal numbers for the six directions in {@link model.ds.hex.HexDirection}.</p>
 * <p>Each game tile can be occupied by one or more counters. These counters
 * are placed on a stack. Additionally, a hex tile implements the {@link common.DataContainer}
 * interface (storing pieces).</p>
 * @author Jan-Philipp Kappmeier
 */
public interface GameTileInterface {


	/**
	 * Returns the neighbouring GameTile in the HexDirection dir.
	 * @param dir
	 */
    public GameTile getNeighbor(HexDirection dir);

    /**
     * Returns true if this GameTile is occupied by a Piece.
     */
	public boolean isOccupied();
	
	/**
	 * Returns true if the neighbouring GameTile in the HexDirection dir is occupied by a Piece.
	 * @param hexDirection
	 */
	public boolean isOccupied(HexDirection hexDirection);

	/**
	 * Adds a new Piece to this GameTile if this is not already occupied. 
	 * However, if piece is a bug we can still add it to this GameTile.
	 * @param piece
	 */
	public void add(Piece piece);

	/**
	 * Removes the top-most game Piece. GameTile becomes unoccupied if the last Piece is removed.
	 */
	public void remove();

	/**GameTileInterface
	 * Puts a game Piece to an empty field.
	 * @param piece
	 */
	public void setPiece(Piece piece);
	
	/**
	 * Checks whether the GameTile in the HexDirecton dir is passable by the top-most Piece of this GameTile. 
	 * The GameTile in HexDirection dir is passable if it is not occupied and the entrance to the GameTile is not blocked such 
	 * that a regular Piece cannot move through. (This method is obviously only reasonable for pieces which can move further than just one GameTile.)
	 * @param dir
	 */
	public boolean isPassable(HexDirection dir);
	
	/**
	 * Checks whether leaving this GameTile in the HexDirection dir would be a connected move. This is true if one of the neighbouring HexDirections is occupied.
	 * @param dir
	 * @return
	 */
	public boolean isConnectedMove( HexDirection dir );
	
	

}